<template>
	<view class="cu-custom-block">
		<view class="cu-custom" :style="[{height:CustomBar + 'px'}]">
			<view class="cu-bar fixed" :style="style" :class="[bgImage!=''?'none-bg text-white bg-img':'',bgColor]">
				<view class="action" @tap="BackPage" v-if="isBack">
					<text class="cuIcon-back"></text>
					<slot name="backText"></slot>
				</view>
				<view class="content" :style="[{top:StatusBar + 'px'}]">
					<slot name="content"></slot>
				</view>
				<slot name="right">
					<image  style="width: 34upx;height: 27upx;margin-right: 10px;" src="/static/menu.png" @tap="showMenuFun()"></image>
				</slot>
			</view>
		</view>
		<view class="menu" v-show="showMenu">
			<view class="cu-list grid no-border col-4">
				<view class="cu-item" v-for="(item,index) in cuIconList2" :key="index">
					<view class="grid-img">
						<image :src="'/static/activity/icon_'+index+'.png'"></image>
					</view>
					<text>{{item.name}}</text>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				StatusBar: this.StatusBar,
				CustomBar: this.CustomBar,
				showMenu:false,
				cuIconList2: [{
					cuIcon: 'questionfill',
					name: '全程0增项'
				}, {
					cuIcon: 'commandfill',
					name: '工地直播'
				}, {
					cuIcon: 'brandfill',
					name: '一站选材'
				}, {
					cuIcon: 'brandfill',
					name: '一站选材'
				}],
			};
		},
		name: 'cu-custom',
		computed: {
			style() {
				var StatusBar= this.StatusBar;
				var CustomBar= this.CustomBar;
				var bgImage = this.bgImage;
				var style = `height:${CustomBar}px;padding-top:${StatusBar}px;`;
				if (this.bgImage) {
					style = `${style}background-image:url(${bgImage});`;
				}
				return style
			}
		},
		props: {
			bgColor: {
				type: String,
				default: ''
			},
			isBack: {
				type: [Boolean, String],
				default: false
			},
			bgImage: {
				type: String,
				default: ''
			},
		},
		methods: {
			BackPage() {
				uni.navigateBack({
					delta: 1
				});
			},
			showMenuFun(){
				this.showMenu=!this.showMenu;
			}
		}
	}
</script>

<style lang="scss">
.cu-custom-block .cu-custom .cu-bar{
	min-height: 50px;
	background: #FFFFFF;
	box-shadow: 0 0.5px 3px rgba(0, 0, 0, 0.1);
}
.menu{
	position: fixed;
	top: 50px;
	/* #ifdef MP-WEIXIN */
	 top: 64px;
	/* #endif */
	/* #ifdef APP-PLUS */
	top: 64px;
	/* #endif */
    width: 100%;
    z-index: 10;
	.cu-list {
		.cu-item image{
			width: 88upx;
			height: 88upx;
		}
	}
}
</style>
